home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / das / ops.h < prev    next >
C/C++ Source or Header  |  1997-09-09  |  6KB  |  245 lines

  1.  
  2. /*
  3.  *  DAS/OPS.H
  4.  *
  5.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  6.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  7.  *    DICE-LICENSE.TXT.
  8.  */
  9.  
  10. #define OSIZE    128
  11. #define OMASK    (OSIZE-1)
  12.  
  13.  
  14. #define OdEQU        -1
  15. #define OdREG        -2
  16. #define OdXREF        -3
  17. #define OdXDEF        -4
  18. #define OdSECTION   -5
  19. #define OdEND        -6
  20. #define OdDS        -7
  21. #define OdDC        -8
  22. #define OdPROCSTART -9
  23. #define OdPROCEND   -10
  24. #define OdMC68020   -11
  25. #define OdMC68881   -12
  26. #define OdDEBUG     -13
  27. #define OdALIGN        -14
  28.  
  29.  
  30. #define OpABCD        1
  31. #define OpADD        2
  32. #define OpADDQ        3
  33. #define OpADDX        4
  34. #define OpAND        5
  35. #define OpASL        6
  36. #define OpASR        7
  37.  
  38. #define OpBCC        8
  39. #define OpBCS        9
  40. #define OpBEQ        10
  41. #define OpBGE        11
  42. #define OpBGT        12
  43. #define OpBHI        13
  44. #define OpBLE        14
  45. #define OpBLS        15
  46. #define OpBLT        16
  47. #define OpBMI        17
  48. #define OpBNE        18
  49. #define OpBPL        19
  50. #define OpBVC        20
  51. #define OpBVS        21
  52. #define OpBRA        22
  53. #define OpBSR        23
  54.  
  55. #define OpBCHG        24
  56. #define OpBCLR        25
  57. #define OpBSET        26
  58. #define OpBTST        27
  59. #define OpCHK        28
  60. #define OpCLR        29
  61. #define OpCMP        30
  62. #define OpDBcc        31
  63. #define OpDIVS        32
  64. #define OpDIVU        33
  65. #define OpEOR        34
  66. #define OpEXG        35
  67. #define OpEXT        36
  68. #define OpILLEGAL   37
  69. #define OpJMP        38
  70. #define OpJSR        39
  71. #define OpLEA        40
  72. #define OpLINK        41
  73. #define OpLSL        42
  74. #define OpLSR        43
  75. #define OpMOVE        44
  76. #define OpMOVEC     45
  77. #define OpMOVEM     46
  78. #define OpMOVEP     47
  79. #define OpMOVEQ     48
  80. #define OpMOVES     49
  81. #define OpMULS        50
  82. #define OpMULU        51
  83. #define OpNBCD        52
  84. #define OpNEG        53
  85. #define OpNEGX        54
  86. #define OpNOP        55
  87. #define OpNOT        56
  88. #define OpOR        57
  89. #define OpPEA        58
  90. #define OpRESET     59
  91. #define OpROL        60
  92. #define OpROR        61
  93. #define OpROXL        62
  94. #define OpROXR        63
  95.  
  96. #define OpRTD        64
  97. #define OpRTE        65
  98. #define OpRTR        66
  99. #define OpRTS        67
  100.  
  101. #define OpSBCD        68
  102. #define OpScc        69
  103. #define OpSTOP        70
  104. #define OpSUB        71
  105. #define OpSUBQ        72
  106. #define OpSUBX        73
  107. #define OpSWAP        74
  108. #define OpTAS        75
  109. #define OpTST        76
  110. #define OpTRAP        77
  111. #define OpTRAPV     78
  112. #define OpUNLK        79
  113.  
  114. #define LIMIT68000  80
  115. #define LIMIT68010  80
  116.  
  117. #define OpEXTB        80
  118.  
  119. #define OpFABS        82
  120. #define Op
  121.  
  122. #define LIMIT68020  90
  123.  
  124. /*
  125.  *  addressing mode determines number of extension words
  126.  *
  127.  *  warning, must chg array in ops.c if you change these defines.
  128.  */
  129.  
  130. #define AB_DN        1
  131. #define AB_AN        2
  132. #define AB_INDAN    3
  133. #define AB_INDPP    4
  134. #define AB_MMIND    5
  135. #define AB_OFFAN    6
  136. #define AB_OFFIDX   7
  137. #define AB_ABSW     8
  138. #define AB_ABSL     9
  139. #define AB_OFFPC    10
  140. #define AB_OFFIDXPC 11
  141. #define AB_IMM        12
  142. #define AB_REGS     13        /*    movem        */
  143. #define AB_BBRANCH  14
  144. #define AB_WBRANCH  15
  145. #define AB_CCR        16
  146. #define AB_SR        17
  147. #define AB_USP        18
  148. #define AB_MULDREGS 19
  149. #define AB_MULDREGU 20
  150.  
  151. #define AF_DN        (1 << AB_DN)
  152. #define AF_AN        (1 << AB_AN)
  153. #define AF_INDAN    (1 << AB_INDAN)
  154. #define AF_INDPP    (1 << AB_INDPP)
  155. #define AF_MMIND    (1 << AB_MMIND)
  156. #define AF_OFFAN    (1 << AB_OFFAN)
  157. #define AF_OFFIDX   (1 << AB_OFFIDX)
  158. #define AF_ABSW     (1 << AB_ABSW)
  159. #define AF_ABSL     (1 << AB_ABSL)
  160. #define AF_OFFPC    (1 << AB_OFFPC)
  161. #define AF_OFFIDXPC (1 << AB_OFFIDXPC)
  162. #define AF_IMM        (1 << AB_IMM)
  163. #define AF_REGS     (1 << AB_REGS)
  164. #define AF_BBRANCH  (1 << AB_BBRANCH)
  165. #define AF_WBRANCH  (1 << AB_WBRANCH)
  166. #define AF_CCR        (1 << AB_CCR)
  167. #define AF_SR        (1 << AB_SR)
  168. #define AF_USP        (1 << AB_USP)
  169. #define AF_MULDREGS (1 << AB_MULDREGS)
  170. #define AF_MULDREGU (1 << AB_MULDREGU)
  171.  
  172. #define AF_ALL        (AF_DN|AF_AN|AF_INDAN|AF_INDPP|AF_MMIND|AF_OFFAN|AF_OFFIDX|AF_ABSW|AF_ABSL|AF_OFFPC|AF_OFFIDXPC|AF_IMM)
  173. #define AF_ALLNA    (AF_DN      |AF_INDAN|AF_INDPP|AF_MMIND|AF_OFFAN|AF_OFFIDX|AF_ABSW|AF_ABSL|AF_OFFPC|AF_OFFIDXPC|AF_IMM)
  174. #define AF_ALT        (AF_DN|AF_AN|AF_INDAN|AF_INDPP|AF_MMIND|AF_OFFAN|AF_OFFIDX|AF_ABSW|AF_ABSL)
  175. #define AF_ALTNA    (AF_DN      |AF_INDAN|AF_INDPP|AF_MMIND|AF_OFFAN|AF_OFFIDX|AF_ABSW|AF_ABSL)
  176. #define AF_ALTM     (            AF_INDAN|AF_INDPP|AF_MMIND|AF_OFFAN|AF_OFFIDX|AF_ABSW|AF_ABSL)
  177. #define AF_CTL        (            AF_INDAN                  |AF_OFFAN|AF_OFFIDX|AF_ABSW|AF_ABSL|AF_OFFPC|AF_OFFIDXPC)
  178. #define AF_CTLNPC   (            AF_INDAN                  |AF_OFFAN|AF_OFFIDX|AF_ABSW|AF_ABSL|         AF_OFFIDXPC)
  179.  
  180. #define S_B    2   /*    1 << 1 */
  181. #define S_W    4   /*    1 << 2 */
  182. #define S_L    16  /*    1 << 4 */
  183. #define S_WL    (S_W|S_L)
  184. #define S_BW    (S_B|S_W)
  185. #define S_ALL    (S_B|S_W|S_L)
  186.  
  187. #define ISF_ABSW    0x01
  188. #define ISF_BYTEB    0x02
  189. #define ISF_ODDREL    0x04    /*  data-rel outer displacement */
  190. #define ISF_BDDREL    0x08    /*  data-rel outer displacement */
  191. #define ISF_INSTBYTE    0x10    /*  byte inst (used for branch) */
  192. /*#define ISF_LABEL2  0x04      extended label - 020 full format    */
  193. /*#define ISF_OFFSET2 0x08      extended offset - 020 full format   */
  194.  
  195. #define EXTF_LWORD  0x0800
  196. #define EXTF_AREG   0x8000
  197. #define EXTF_FULL   0x0100    /*  MC68020 full format */
  198. #define EXTF_NOIDX  0x0040
  199. #define EXTF_NOBREG 0x0080
  200.  
  201. #define EXTF_BDNULL 0x0010
  202. #define EXTF_BDWORD 0x0020
  203. #define EXTF_BDLONG 0x0030
  204. #define EXTF_BDMASK 0x0030
  205.  
  206. #define EXTF_ODNULL 0x0001
  207. #define EXTF_ODWORD 0x0002
  208. #define EXTF_ODLONG 0x0003
  209. #define EXTF_ODMASK 0x0003
  210.  
  211. #define EXTF_MEMIND 0x0004
  212.  
  213.  
  214. #define IMM07    1
  215. #define IMM18    2
  216. #define IMM256    3
  217. #define IMMBR    4
  218. #define IMMB    5   /*    like #imm normal byte, but independant of inst size */
  219. #define IMM0F    6   /*    low 4 bits of instruction, #0-15            */
  220.  
  221. typedef struct OpCod {
  222.     char    *OpName;
  223.     short   Id;
  224.     uword   Template;
  225.     char    B_Rs;
  226.     char    B_EAs;
  227.     char    B_Rd;
  228.     char    B_EAd;
  229.     char    B_Siz;
  230.     char    Sizes;
  231.     long    SModes;
  232.     long    DModes;
  233.     short   Special;
  234.  
  235.     struct OpCod   *HNext;
  236.     struct OpCod   *SibNext;
  237. } OpCod;
  238.  
  239. extern short ExtWords[];    /*  ExtWords[ABmode]    */
  240. extern short RegCode[];
  241. extern short EACode[];
  242. extern short PCRel[];
  243.  
  244.  
  245.